/*
 * Created on 19.2.2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;


public class RecipeContainer implements Serializable {
	private ArrayList recipes;

    /**
     * 
     */
	public RecipeContainer() {
		recipes = new ArrayList();
	}

    /**
     * 
     */
	public RecipeContainer(ArrayList recipes) {
		this.recipes = recipes;
	}

    /**
     * 
     */
	public ArrayList getRecipeHeaders()	{
		ArrayList recipeHeaders = new ArrayList();
		for(Iterator it=recipes.iterator();it.hasNext();)
					recipeHeaders.add(((Recipe)it.next()).getName());
		return recipeHeaders;
	}
//	public String toString() 
//	{
//		String list = "";
//		for(Iterator it=recipes.iterator();it.hasNext();)
//					list+=it.next()+"\n";
//		return list;
//	}

    /**
     * 
     */
	public ArrayList getRecipes() {
		return recipes;
	}

    /**
     * 
     */
	public void setRecipes(ArrayList list) {
		recipes = list;
	}

    /**
     * 
     */
    public int getRecipeId(String name) {
        int returnValue = -1;

        for(Iterator it=recipes.iterator(); it.hasNext(); ) {
            Recipe res = (Recipe)it.next();
            if( res.getName().equalsIgnoreCase(name))
                returnValue = res.getId();
        }
        return returnValue;
    }
}
